/* 背包应用样式 */
.backpack-app {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* 确保app-content有正确的定位上下文 */
.backpack-app #app-content {
  position: relative;
}

/* 背包列表容器 */
.backpack-item-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
  background: #f8fafb;
}

/* 背包头部 */
.backpack-header {
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #f0f0f0;
}

.backpack-title {
  color: #333;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 2px 0;
  text-align: center;
}

.backpack-stats {
  color: #666;
  font-size: 12px;
  text-align: center;
}

/* 背包物品网格 - 改为单列布局 */
.backpack-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 背包物品卡片 - 紧凑样式 */
.backpack-item {
  background: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid #f0f0f0;
  cursor: pointer;
}

.backpack-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 物品信息容器 */
.backpack-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* 物品头部 - 名称和类型 */
.backpack-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
}

.backpack-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  line-height: 1.2;
  flex: 1;
}

.backpack-item-type {
  background: #667eea;
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.backpack-item-description {
  font-size: 12px;
  color: #666;
  line-height: 1.3;
  margin: 2px 0;
}

/* 物品底部 - 数量和使用按钮 */
.backpack-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  gap: 6px;
}

.backpack-item-quantity {
  font-size: 12px;
  font-weight: 600;
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  align-self: flex-start;
  white-space: nowrap;
}

/* 使用物品按钮 */
.use-item-btn {
  background: #667eea;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  min-width: 40px;
}

.use-item-btn:hover {
  background: #5a6fd8;
  transform: translateY(-1px);
}

.use-item-btn:active {
  transform: translateY(0);
}

/* 物品类型标签栏样式 - 参考shop-app */
.backpack-type-tabs {
  display: flex;
  padding: 8px 12px;
  background: #667eea;
  overflow-x: auto;
  gap: 6px;
  border-bottom: 1px solid #5a6fd8;
}

.backpack-type-tab {
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.3s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.backpack-type-tab.active {
  background: rgba(255, 255, 255, 0.9);
  color: #667eea;
  border-color: rgba(255, 255, 255, 0.9);
}

.backpack-type-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
}

/* 搜索栏样式 */
.backpack-search-bar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: #667eea;
  border-bottom: 1px solid #5a6fd8;
  gap: 8px;
}

.backpack-search-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-size: 14px;
  border-radius: 16px;
  outline: none;
  transition: all 0.3s ease;
}

.backpack-search-input:focus {
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.backpack-search-input::placeholder {
  color: #999;
}

.backpack-search-clear {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.backpack-search-clear:hover {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

/* 空状态 */
.backpack-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.7;
}

.empty-title {
  color: white;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 10px;
}

.empty-subtitle {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.empty-hint {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  margin-bottom: 5px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  max-width: 300px;
}

.retry-button {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.retry-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* 错误状态 */
.error-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
}

.error-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.error-text {
  color: white;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.error-detail {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  margin-bottom: 20px;
}

/* 加载状态 */
.loading-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
}

.loading-icon {
  font-size: 48px;
  margin-bottom: 20px;
  animation: spin 2s linear infinite;
}

.loading-text {
  color: white;
  font-size: 16px;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 提示消息 */
.backpack-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #333;
  color: white;
  padding: 12px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 10000;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.backpack-toast.show {
  transform: translateX(-50%) translateY(0);
}

.backpack-toast.success {
  background: #4caf50;
}

.backpack-toast.error {
  background: #f44336;
}

.backpack-toast.warning {
  background: #ff9800;
}

.backpack-toast.info {
  background: #2196f3;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 10px;
    padding: 20px;
  }

  .backpack-item-list {
    padding: 4px 6px;
  }

  .backpack-header {
    padding: 6px 8px;
    margin-bottom: 6px;
  }

  .backpack-grid {
    gap: 3px;
  }

  .backpack-item {
    padding: 6px 8px;
  }

  .backpack-type-tabs {
    padding: 6px 8px;
    gap: 4px;
  }

  .backpack-type-tab {
    padding: 3px 8px;
    font-size: 11px;
  }

  .backpack-search-bar {
    padding: 6px 8px;
    gap: 6px;
  }

  .backpack-search-input {
    padding: 6px 10px;
    font-size: 13px;
  }

  .backpack-search-clear {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .modal-content {
    width: 98%;
    margin: 5px;
    padding: 16px;
  }

  .backpack-item-list {
    padding: 3px 4px;
  }

  .backpack-header {
    padding: 6px 8px;
    margin-bottom: 6px;
  }

  .backpack-grid {
    gap: 2px;
  }

  .backpack-item {
    padding: 6px;
  }

  .backpack-item-info {
    gap: 2px;
  }

  .backpack-item-footer {
    gap: 4px;
    margin-top: 3px;
  }

  .use-item-btn {
    padding: 3px 6px;
    font-size: 10px;
    min-width: 35px;
  }

  .quantity-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .form-input {
    padding: 10px 12px;
    font-size: 13px;
  }

  .modal-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
}

/* 滚动条样式 */
.backpack-item-list::-webkit-scrollbar {
  width: 4px;
}

.backpack-item-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.backpack-item-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.backpack-item-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* 自定义弹窗样式 - 参考live-app */
.custom-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 25px;
  width: 85%;
  max-width: 400px;
  border: 1px solid #ededf0;
  position: relative;
  animation: slideUp 0.3s ease-out;
  color: #333333;
  max-height: 80vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 15px;
  margin-bottom: 20px;
  border-bottom: 1px solid #ededf0;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: #333333;
}

.modal-body {
  padding: 0;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quantity-btn {
  width: 40px;
  height: 40px;
  border: 1px solid #ddd;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.quantity-btn:hover {
  background: #e9ecef;
  border-color: #667eea;
}

.quantity-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quantity-display {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  padding: 12px 0;
  background: #f8f9fa;
  border-radius: 8px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.modal-btn {
  flex: 1;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5a6fd8;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

/* 装备按钮样式（绿色） */
.equip-item-btn {
  padding: 6px 14px;
  background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(64, 192, 87, 0.3);
}

.equip-item-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(64, 192, 87, 0.4);
}

.equip-item-btn:active {
  transform: translateY(0);
}

/* 装备部位选择模态框 */
.backpack-equip-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: equipFadeIn 0.2s;
}

@keyframes equipFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.backpack-equip-modal {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: equipSlideUp 0.3s;
}

@keyframes equipSlideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.backpack-equip-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e9ecef;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.backpack-equip-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.backpack-equip-modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.backpack-equip-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.backpack-equip-modal-body {
  padding: 20px;
}

.backpack-equip-modal-body p {
  margin: 0 0 16px 0;
  color: #495057;
  font-size: 14px;
}

.backpack-equip-slot-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.backpack-equip-slot-btn {
  padding: 12px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.backpack-equip-slot-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.backpack-equip-slot-btn:active {
  transform: translateY(0);
}
